package cn.cheegon.blog.common.config;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


/**
 * @Desc: 用于配置不需要保护的资源路径
 * @Author: cheegon
 * @Date: Create in 2024/6/11  上午10:48
 */
@Getter
@Setter
@ConfigurationProperties(prefix = "secure.ignored")
@EnableConfigurationProperties(IgnoreUrlsConfig.class)
@RefreshScope
public class IgnoreUrlsConfig {

    private List<String> urls = new ArrayList<>();

//    public String permit() {
//        return  StringUtils.join(urls, ",");
//    }
    public String[] permit() {
        return  urls.toArray(new String[urls.size()]);
    }
}
